<template>
	<view class="brush-container">
		<navbar-btn :data="questionarr"></navbar-btn>
		<view class="brush-list">
			<view class="brush-list-title">
				【面试题】：{{currentobj.title}}
			</view>
		</view>

		<info-btn></info-btn>
	</view>
</template>

<script>
	import InfoBtn from "@/components/infobtn.vue";
	import NavbarBtn from "@/components/navbarbtn.vue";
	export default {
		components: {
			InfoBtn,
			NavbarBtn
		},
		data() {
			return {
				// 总共面试题库列表
				questionarr: [{
						id: 0,
						title: "问题1",
						answer: "哈哈哈哈哈哈哈"
					}, {
						id: 1,
						title: "问题2",
						answer: "呵呵呵呵呵呵呵呵呵呵呵"
					},
					{
						id: 2,
						title: "问题3",
						answer: "嘻嘻嘻嘻嘻嘻嘻嘻"
					}
				],
				randomarr: [], // 打乱后的随机数组
				currentobj: {}, // 当前显示的题目
				question: 1, // 当前是第几道题
			}
		},
		onLoad(params) {
			// 动态设置导航栏
			uni.setNavigationBarTitle({
				title: params.title
			})
			
			// 点击进来该页面的时候，获取后台数据，展示第一条数据
			// 先将所有数组进行打乱: uni.$u.randomArray(this.questionarr)
			this.randomarr = uni.$u.randomArray(this.questionarr);
			// 只需要将第一条数据放在当前显示数组中
			this.currentobj = this.randomarr[this.question - 1];
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
	.brush-container {
		.brush-list {
			padding: 18rpx 24rpx;

			.brush-list-title {
				font-weight: bold;
			}

			.brush-list-option {
				margin-top: 20rpx;

				.brush-option-item {
					margin-top: 20rpx;
				}
			}

		}
	}
</style>
